package com.rdgzs.framework.web;

import com.rdgzs.framework.constant.SysConstants;

public class AjaxException extends RuntimeException{
	private static final long serialVersionUID = 1L;
	public AjaxException(String message) {
		super(createFriendlyErrMsg(message));
	}
	public AjaxException(Throwable throwable){
		super(throwable);
    }
	public AjaxException( String message,Throwable throwable){
		super(createFriendlyErrMsg(message),throwable);
	}
    /**

     * 创建友好的报错信息

     * */
	private static String createFriendlyErrMsg(String msgBody) {
		String prefixStr = SysConstants.prefixStr;
		String suffixStr = SysConstants.suffixStr;
		StringBuffer friendlyErrMsg = new StringBuffer();
		friendlyErrMsg.append(prefixStr);
		friendlyErrMsg.append(msgBody);
        friendlyErrMsg.append(suffixStr);
        return friendlyErrMsg.toString();
	    }
}

